import cv2
import numpy as np
import matplotlib.pyplot as plt
import os

IMG_PATH = r"D:\MathmaticModel\Pic_data"

def read_pic(img_path):
    f_list = np.array([])
    pic_tags = np.array([])
    
    for f in os.listdir(img_path):
        img = cv2.imread(os.path.join(img_path, f))
        # 跳过损坏的图片
        if img is None:
            continue
            
        f_list = np.append(f_list, f)
        
        # 如果图片名称中含Normal,说明是正常道路
        if(f.find('normal') != -1):
            pic_tags = np.append(pic_tags, 1)
        else:
             pic_tags = np.append(pic_tags, 0)
    return [f_list, pic_tags]


